Conventionally, as disclosed in Japanese Laid-Open Patent Publication No. 2002-153673 (hereinafter referred to as Patent Document 1), for example, known is a game apparatus which calculates an action of a player throwing a punch, based on data outputted by an acceleration sensor, so as to allow the player to play a boxing game. The game apparatus disclosed in Patent Document 1 is structured such that a glove unit functioning as a controller of the game apparatus includes an acceleration sensor which detects an acceleration in three axial directions, that is, a front-rear (Y-axis) direction, a left-right (X-axis) direction, and an up-down (Z-axis) direction. The above-described apparatus analyzes an output waveform outputted by the acceleration sensor so as to identify a type of the punch thrown by the player. Specifically, the game apparatus calculates, based on an output waveform represented by the acceleration data detected in the Y-axis direction, a time period for a start of the punch thrown by the player to an end of the same punch. Next, the game apparatus uses output waveforms represented by the acceleration data in the X-axis direction and the acceleration data in the Z-axis direction, respectively, which are obtained in the time period from the start of the punch thrown by the player to the end of the same punch, so as to extract data representing, for example, a maximum value, a minimum value, amplitude, the number of times a peak appears, and an integration value. The game apparatus identifies the type of extracted data and a waveform pattern obtained for each of the types of the punches. After the identification of the type of the punch, the apparatus performs a game process in accordance with the type of the punch having been identified.
However, in accordance with a technique described in Patent document 1, since the game process in accordance with the type of the punch is performed after the player finished throwing the punch, and also after they type of the punch is determined, it is impossible to draw an image representing the punch thrown by the player. That is, in the technique according to Patent document 1, in the case where the image representing the punch thrown by the player, for example, such as an image in which a player character is throwing a punch, or an image in which an object indicating a fist of the player is moving is to be drawn, the image will only be displayed on a screen after the player finishes the punching motion. In an action game like this, a battle game and the like which require a quick response to an input by the player, this bad response is of problem, and decreases an interest factor of a game. Therefore, the technique according to Patent Document 1 basically adopts a drawing using a first person perspective, and displays, straight away, an image showing an enemy character suffering a damage without drawing an image showing the punching motion of the player when it is determined that the punch hits the enemy character.
Further, when the above-described game apparatus represents and displays a punch thrown by a character controlled by the player, it is necessary to render, after the player finishes the punch action, an image representing the punch action based on the type of the punch, and thus the representation and display of the user's action in increasingly delayed.
Therefore, in certain example embodiments a storage medium is provided having an information processing program stored thereon and an information processing apparatus which are used for executing a process of quickly representing an action of a user in accordance with data outputted by an acceleration sensor.
The reference numerals, step numbers and the like in parentheses indicate the correspondence with the embodiment described below in order to aid in understanding the certain example embodiments.
A first aspect is a storage medium having stored thereon an information processing program executed y a computer (10) of an information processing apparatus (5) which executes a process using acceleration data (Da) outputted by an acceleration sensor (701) for detecting acceleration applied to a predetermined housing (7, 71). The information processing program causes the computer to function as an acceleration data acquisition means (an CPU executing step 43, hereinafter describing a step number only), an acceleration determination means (S82 to S89), moving direction calculation means (S48), and a processing means (S49). The acceleration data acquisition means repeatedly acquires the acceleration data. The acceleration determination means determines whether an acceleration represented by the acceleration data acquired by the acceleration data acquisition means is an acceleration (Dd) at the time of accelerating, which is applied when the predetermined housing is moved and accelerated in a predetermined direction, or is an acceleration (De) at the time of decelerating, which is applied when the predetermined housing is moved and decelerated in the predetermined direction. The moving direction calculation means calculates a moving direction (dir) in which the predetermined housing moves by using the acceleration at the time of decelerating which is determined by the acceleration determination means. The processing means performs a predetermined process by using the moving direction calculated by the moving direction calculation means.
In a second aspect based on the first aspect, the acceleration determination means includes a first accumulation means (S89), a second accumulation means (S86 to 88), and an attenuation means (S82). The first accumulation means accumulates an acceleration (dp<0) applied to a predetermined direction of the predetermined housing, by using the acceleration data acquired by the acceleration data acquisition means. The second accumulation means accumulates, within a range not exceeding a value accumulated by the first accumulation means, an acceleration (dp>0) applied to a reverse direction of the predetermined direction by using the acceleration data acquired by the acceleration data acquisition means. The attenuation means attenuates values accumulated by the first accumulation means and the second accumulation means, each at a predetermined rate (DAMP). The moving direction calculation means calculates the moving direction of the predetermined housing by using a value accumulated by the second accumulation means as the acceleration at the time of decelerating.
In a third aspect based on the second aspect, the acceleration determination means further includes an acceleration component calculation means (S83, S84) for calculating respective acceleration components (dp) applied to a plurality of directions (0th to N−1th direction in FIG. 19) of the predetermined housing, by using the acceleration data acquired by the acceleration data acquisition means. The first accumulation means accumulates acceleration components (dp<0; Yes in S85) applied in a forward direction of each of the plurality of directions. The second accumulation means accumulates acceleration components (dp 0; No in S85) applied in a reverse direction of said each of the plurality of directions within a range not exceeding an accumulated value of the acceleration components applied in the forward direction which is opposite to the reverse direction, the accumulated value being accumulated by the first accumulation means. The attenuation means attenuates, at predetermined rates, respectively, values which are accumulated, with respect to said each of the plurality of directions, by the first accumulation means and the second means. The moving direction calculation means calculates the moving direction of the predetermined housing by using a value, which is obtained by summing values respectively accumulated by the second accumulation means with respect to said each of the plurality of directions, as the acceleration at the time of decelerating.
In a fourth aspect based on the second aspect, the acceleration determination means further includes an acceleration component calculation means. The acceleration component calculation means calculates acceleration components applied to a plurality of directions of the predetermined housing, by using the acceleration data acquired by the acceleration data acquisition means. The first accumulation means accumulates acceleration components applied in a forward direction of each of the plurality of directions. The second accumulation means accumulates acceleration components applied in a reverse direction of said each of the plurality of directions within a range not exceeding an accumulated value of the acceleration components applied in the forward direction which is opposite to the reverse direction, the accumulated value being accumulated by the first accumulation means. The attenuation means attenuates, at predetermined rates, respectively, values which are accumulated, with respect to said each of the plurality of directions, by the first accumulation means and the second accumulation means. The moving direction calculation means calculates the moving direction of the predetermined housing by using a maximum value, among values accumulated by the second accumulation means, as the acceleration of the decelerating.
In a fifth aspect based on the first aspect, the acceleration determination means further includes an acceleration component calculation means. The acceleration component calculation means calculates acceleration components applies to a plurality of directions of the predetermined housing, by using the acceleration data acquired by the acceleration data acquisition means. The acceleration determination means determines whether each of the acceleration components calculated by the acceleration component calculation means is the acceleration at the time of accelerating or the acceleration at the time of decelerating. The moving direction calculation means calculates the moving direction of the predetermined housing by using a value which is obtained by summing the acceleration at the time of decelerating determined by the acceleration determination means with respect to each of the plurality of directions.
In a sixth aspect based on the first aspect, the acceleration determination means further includes an acceleration component calculation means. The acceleration determination means calculates acceleration components applied to a plurality of directions of the predetermined housing, by using the acceleration data acquired by the acceleration data acquisition means. The acceleration determination means determines whether each of the acceleration components calculated by the acceleration component calculation means is the acceleration at the time of accelerating or the acceleration at the time of the predetermined housing by using a maximum value among the acceleration at the time of decelerating determined by the acceleration determination means.
In a seventh aspect based on the first aspect, when a magnitude (Sp) of the acceleration at the time of decelerating is larger than a predetermined value (Sp)_max)(Yes in S102), the moving direction calculation means calculates the moving direction of the predetermined housing by using the acceleration at the time of decelerating.
In an eighth aspect based on the seventh aspect, the computer is further caused to function as an elapsed time measuring means (S105, S107). The elapsed time measuring means measures an elapsed time (Dh) after the moving direction is calculated by the moving direction calculation means. The processing means performs the predetermined process by using the moving direction calculated by the moving direction calculation means when the elapsed time reaches a predetermined time.
In a ninth aspect based on the seventh aspect, the computer is further caused to function as a predetermining value setting means (S104). The predetermined value setting means sets, when the magnitude of the acceleration at the time of decelerating becomes larger than the predetermined value, the magnitude of the acceleration at the time of decelerating as a latest predetermined value.
In a tenth aspect based on the first aspect, when the magnitude of the acceleration at the time of decelerating becomes smaller than the predetermined value, the predetermined value setting means decreases the predetermined value by a predetermined amount.
In an eleventh aspect based on the ninth aspect, the predetermined value setting means further sets a fixed value previously, in addition to the predetermined value. When the magnitude of the acceleration at the time of decelerating is larger than both of the predetermined value and the fixed value (Yes in S102), the moving direction calculation means calculates the moving direction of the predetermined housing by using the acceleration at the time of decelerating.
In a twelfth aspect based on the first aspect, the computer is further caused to function as a deceleration vector calculation means (S90). The deceleration vector calculation means calculates a deceleration vector (Df), which represents a direction in which the predetermined housing is moving at a decelerated rate, by using the acceleration at the time of decelerating determined by the acceleration determination means. The moving direction calculation means calculates the moving direction by using the deceleration vector calculated by the deceleration vector calculation means.
In a thirteenth aspect based on the twelfth aspect, the acceleration determination means includes a first accumulation means, a second accumulation means, and an attenuation means. The first accumulation means accumulates an acceleration applied in a predetermined direction of the predetermined housing, by using the acceleration data acquired by the acceleration data acquisition means. The second accumulation means accumulates, within a range not exceeding a value accumulated by the first accumulation means, an acceleration applied in a reverse direction of the predetermined direction by using the acceleration data acquired by the acceleration data acquisition means. The attenuation means attenuates value accumulated respectively by the first accumulation means and the second accumulation means, each at a predetermined rate. The deceleration vector calculation means calculates the deceleration vector by using a value accumulated by the second accumulation means as an accumulated value of the acceleration at the time of decelerating.
In a fourteenth aspect based on the thirteenth aspect, the acceleration determination means further included an acceleration component calculation means. The acceleration component calculation means calculates acceleration components applied to a plurality of directions of the predetermined housing, by using the acceleration data acquired by the acceleration data acquisition means. The first accumulation means accumulates acceleration components applied in a forward direction of each of the plurality of directions. The second accumulation means accumulates acceleration components applied in a reverse direction of said each of the plurality of directions within a range not exceeding an accumulated value of the acceleration components applied in the forward direction which is opposite to the reverse direction, the accumulated value being accumulated by the first accumulation means. The attenuation means attenuates, at predetermined rates, respectively, values which are accumulated, with respect to said each of the plurality of directions, by the first accumulation means and the second accumulation means. The deceleration vector calculation means calculates the deceleration vector by summing values accumulated by the second accumulation means with respect to said each of the plurality of directions.
In a fifteenth aspect based on the thirteenth aspect, the acceleration determination means further includes an acceleration component calculation means. The acceleration component calculation means calculates acceleration components applied to a plurality of directions of the predetermined housing, by using the acceleration data acquired by the acceleration data acquisition means. The first accumulation means accumulates acceleration components applied in a forward direction of each of the plurality of directions. The second accumulation means accumulates acceleration components applied in a reverse direction of said each of the plurality of the directions within a range not exceeding an accumulated value of the acceleration components applied in the forward direction which is opposite to the reverse direction, the accumulated value being accumulated by the first accumulated means. The attenuation means attenuates, at predetermined rates, respectively, values which are accumulated, with respect to said each of the plurality of directions, by the first accumulation means and the second accumulation means. The deceleration vector calculation means calculates the deceleration vector by using a maximum value, among values accumulated by the second accumulation means.
In a sixteenth aspect based on the twelfth aspect, the computer is further caused to function as a gravity direction calculation means (S44). The gravity direction calculation means calculates a direction of a gravity acceleration (Pos) applied to the predetermined housing by using the acceleration data acquired by the acceleration data acquisition means. The moving direction calculation means calculates the moving direction relative to the direction of the gravity acceleration being applied in a accordance with the direction of the gravity acceleration calculated by the gravity direction calculation means and a direction represented by the deceleration vector.
In a seventh aspect based on the twelfth aspect, when a magnitude of the deceleration vector calculated by the deceleration vector calculation means is larger than a predetermined value, the moving direction calculation means calculates a direction of the deceleration vector as the moving direction.
In a eighteenth aspect based on the seventeenth aspect, the computer is further caused to function as a predetermined value setting means. The predetermined value setting means sets, when the magnitude of the deceleration vector calculated by the deceleration vector calculation means becomes larger than the predetermined value, the magnitude of the deceleration vector as a new predetermined value.
In a nineteenth aspect based on the eighteenth aspect, when the magnitude of the deceleration vector calculated by the deceleration vector calculation means becomes smaller than the predetermined value, the predetermined value setting means decreases the predetermined value by a predetermined amount.
In a twentieth aspect based on the eighteenth aspect, the predetermined value setting means further sets a previously fixed value, in addition to the predetermined value. When the magnitude of the deceleration vector calculated by the deceleration vector calculation means is larger than both of the predetermined value and the fixed value, the moving direction calculation means calculates the direction of the deceleration vector as the moving direction.
In a twenty-first aspect based on the seventeenth aspect, the computer is further caused to function as an elapsed time measuring means. The elapsed time measuring means measures an elapsed time after the moving direction is calculated by the moving direction calculation means. The processing means performs the predetermined process by using the moving direction calculated by the moving direction calculation means when the elapsed time reaches a predetermined time.
In a twenty-second aspect based on the first aspect, when acquiring acceleration data representing as acceleration applied to a predetermined direction of the predetermined housing and acquiring acceleration data representing an acceleration applied in a reverse direction of the predetermined direction immediately thereafter, the acceleration determination means determines the acceleration data representing the acceleration applied to the predetermined direction of the predetermined housing as the acceleration at the time of accelerating, and also determines the acceleration data representing the acceleration applied n the reverse direction of the predetermined direction as the acceleration at the time of decelerating.
In a twenty-third aspect based on the first aspect, the computer is further caused to function as a gravity component calculation means (S45) and a gravity component elimination means (S46). The gravity component calculation means calculates a gravity acceleration component (Db) applied to the predetermined housing by using the acceleration data acquired by the acceleration data acquisition means. The gravity component elimination means eliminates the gravity acceleration component, which is calculated by the gravity component calculation means, from acceleration represented by the acceleration data acquired by the acceleration data acquisition means. The acceleration determination means uses an acceleration (De) from which the gravity acceleration component has been eliminated by the gravity component eliminated means.
A twenty-fourth aspect is an information processing apparatus for performing a process using acceleration data outputted by an acceleration sensor which detects an acceleration applied to a predetermined housing. The information processing apparatus includes an acceleration data acquisition means, an acceleration determination means, a moving directions calculation means, and a processing means. The acceleration data acquisition means acquires the acceleration data repeatedly. The acceleration determination means determines whether an acceleration represented by the acceleration data acquired by the acceleration data acquisition means in an acceleration at the time of accelerating, which is applied when the predetermined housing is moved and accelerated in a predetermined direction, or is an acceleration at the time of decelerating, which is applied when the predetermined housing is moved and decelerated in the predetermined direction. The moving direction calculation means calculates a moving direction in which the predetermined housing moves by using the acceleration at the time of decelerating which is determined by the acceleration determination means. The processing means performs a predetermined process by using the moving direction calculated by the moving direction calculation means.
According to the above-described first aspect, by using the acceleration at the time of decelerating which is applied when the housing is moving at a decelerated rate, it is possible to recognize directions of the housing being moved and waved increasingly quickly, and calculate the directions accurately.
According to the above-described second and thirteenth aspects, positive variables are set by accumulating an acceleration applied in a predetermined direction and an acceleration applied in a reverse direction of the predetermined direction, respectively, and the positive variables are each attenuated at a predetermined rate. The variables are controlled such that a variable for the reverse direction does not exceed a variable for the predetermined direction, whereby and acceleration applied at the time of accelerating and an acceleration at the time of decelerating applied immediately after the acceleration are paired up as a set. Accordingly, the acceleration at the time of decelerating can be determined accurately.
According to the above-described third, fifth, and fourteenth aspects, determination of the acceleration at the time of decelerating is performed in a plurality of directions, whereby accuracy in calculating the moving direction of the housing is improved. Further, the acceleration at the time of decelerating with respect to each of the plurality of directions is summed, the thus the moving direction of the housing is not limited to the plurality of directions, but is represented in an analog manner, whereby a most appropriate direction is calculated. Further, even if any one of the plurality of directions has a noise, the direction having the noise will not be misrecognized as the moving direction of the housing.
According to the above-described fourth, sixth, and fifteenth aspects, determination of the acceleration at the time of decelerating is performed with respect to each of the plurality of directions, whereby accuracy in calculating the moving direction of the housing is increasing improved. Further, by using the acceleration at the time of maximumly decelerating, a process of calculating the moving direction of the housing, among the plurality of directions, can be simplified.
According to the above-described seventh and seventeenth aspects, since the moving direction is calculated when the magnitudes of the acceleration at the time of decelerating and the deceleration vector are each larger than the predetermined value, it is possible to prevent the moving direction of the housing from being calculated wrongly.
According to the above-described eighth and twenty-first aspects, the elapsed time after calculating the moving direction can be used as a degree of reliability of the moving direction, and therefore, when a more assured moving direction is to be obtained, a predetermined processing can be performed by using a direction calculated when the elapsed time has reached a predetermined time.
According to the above-described ninth and eighteenth aspects, since maximum values representing the magnitudes of the acceleration at the time of decelerating and the deceleration vector are each set as a predetermined value, it is possible to prevent a case where the calculation of the moving directions is performed frequently.
According to the above-described tenth and nineteenth aspects, since the predetermined values attenuates, it is possible to calculate a subsequent new moving direction.
According to the above-described eleventh and twentieth aspects, an effect of an acceleration exerted by a force other than movement of the housing, such as a gravity acceleration, can be eliminated, whereby it is possible to prevent miscalculation of the moving direction of the housing.
According the above-described twelfth aspect, by using the acceleration at the time of decelerating, the deceleration vector representing the moving direction of the housing at a decelerated rate is calculated. Accordingly the moving direction or the waving direction of the housing can be calculated two-dimensionally or three-dimensionally.
According to the above-described sixteenth aspect, it is possible to calculate the moving direction of the housing relative to the gravity direction applied to the housing.
According to the above-described twenty-second aspect, by detecting the acceleration, which is applied in the reverse direction of the predetermined direction immediately after the acceleration is applied in the predetermined direction, it is possible to easily determine that the acceleration in the opposite direction is the acceleration applied at the time of decelerating.
According to the above-described twenty-third aspect, by eliminating the gravity component constantly applied to the housing, it is possible to accurately calculate the moving direction and the waving direction of the housing.
According to the information processing apparatus, it is possible to obtain the same effect as the storage medium having the above-described information processing program stored thereon.
These and other objects, features, aspects, and advantages of certain example embodiments will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.